<?php
header('Content-type: text/xml');
require('setup.php');
include 'db.php';
$smarty = new Smarty_pigier();
session_start();
if (!$_SESSION['_type']==2) {
header("location:index.php");
}
else {
	$conn=connectDB();	
	$result=selectcoursByIdCategorie($_POST['categorie']);
	$arr=array();
	$idcour=0;
	while ($row = mysql_fetch_array($result)) {
		$arr[$row['id_cours']]=$row['nomcours'];
		if (id==0) {
			$idcour=$row['id_cours'];
		}
		
		//array_push($arr, $row['nomcours']);
	}
	$idcour=1;
	if ($idcour!=0) {
		$resultfichier = selectCourfiles($idcour);
		$arrayoffile = array();
		while ($row = mysql_fetch_array($resultfichier)) {
			array_push($arrayoffile, $row);
			//array_push($arr, $row['nomcours']);
		}
		$smarty->assign('fichiercours', $arrayoffile);
	}
	$smarty->assign('data', $arr);
	$smarty->display('xmlfile.tpl');
}




?>
